package com.apes.fn.mdm.serveTypeContrast;

import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author wuq
 * @Date 2022-1-21
 */
@Service
public class ServeTypeContrastService {

    @Autowired
    private ServeTypeContrastRepository serveTypeContrastRepository;

    public ServeTypeContrast create(SimpleRequest request){
        ServeTypeContrast serveTypeContrast = request.getO(ServeTypeContrast.class);

        return serveTypeContrastRepository.saveAndFlush(serveTypeContrast);
    }

    public ServeTypeContrast update(SimpleRequest request){
        ServeTypeContrast serveTypeContrast = request.getO(ServeTypeContrast.class);

        return serveTypeContrastRepository.saveAndFlush(serveTypeContrast);
    }

    public String delete(SimpleRequest request) {
        ServeTypeContrast serveTypeContrast = request.getO(ServeTypeContrast.class);
        serveTypeContrastRepository.delete(serveTypeContrast);
        return "删除成功";
    }
}
